from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware

from app.routers import locate

app = FastAPI(title="XPath Generalization Service", version="0.1.0")

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

app.include_router(locate.router, prefix="/api")


@app.get("/health")
async def read_health() -> dict[str, str]:
    return {"status": "ok"}
